import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SGangFightsGetRooms } from "../../../../../Message/Public/SGangFightsGetRooms";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
import { SGangFightsRoom } from "../../../../../Message/Public/SGangFightsRoom";
type int = number;
//class GangFightsGetRoomsCommand
    
    export  class GangFightsGetRoomsCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SGangFightsGetRooms;
            loc1.rooms.sort(this.sortByScore);
            NetDispatcher.dispatchCmd(ServerCommand.GangFightsRoomListCommand, loc1);
            return;
        }

        /* internal  */sortByScore(arg1: SGangFightsRoom, arg2: SGangFightsRoom): int
        {
            if (arg1.maxMark == 0) 
            {
                return 1;
            }
            if (arg1.maxMark > arg2.maxMark) 
            {
                return 1;
            }
            return -1;
        }
    }
